#include "Vector4.h"

namespace lib3dw
{
	void Vector4::operator += (const float s)
	{
		x += s;
		y += s;
		z += s;
		w += s;
	}

	void Vector4::operator += (const Vector4 &v)
	{
		x += v.x;
		y += v.y;
		z += v.z;
		w += v.w;
	}

	void Vector4::operator -= (const float s)
	{
		x -= s;
		y -= s;
		z -= s;
		w -= s;
	}

	void Vector4::operator -= (const Vector4 &v)
	{
		x -= v.x;
		y -= v.y;
		z -= v.z;
		w -= v.w;
	}

	void Vector4::operator *= (const float s)
	{
		x *= s;
		y *= s;
		z *= s;
		w *= s;
	}

	void Vector4::operator *= (const Vector4 &v)
	{
		x *= v.x;
		y *= v.y;
		z *= v.z;
		w *= v.w;
	}

	void Vector4::operator /= (const float s)
	{
		x /= s;
		y /= s;
		z /= s;
		w /= s;
	}

	void Vector4::operator /= (const Vector4 &v)
	{
		x /= v.x;
		y /= v.y;
		z /= v.z;
		w /= v.w;
	}
	
	Vector3 Vector4::xyz()
	{
		return Vector3(x, y, z);
	}

	Vector4 operator + (const Vector4 &u, const Vector4 &v)
	{
		return Vector4(u.x + v.x, u.y + v.y, u.z + v.z, u.w + v.w);
	}

	Vector4 operator + (const Vector4 &v, const float s)
	{
		return Vector4(v.x + s, v.y + s, v.z + s, v.w + s);
	}

	Vector4 operator + (const float s, const Vector4 &v)
	{
		return Vector4(v.x + s, v.y + s, v.z + s, v.w + s);
	}

	Vector4 operator - (const Vector4 &u, const Vector4 &v)
	{
		return Vector4(u.x - v.x, u.y - v.y, u.z - v.z, u.w - v.w);
	}

	Vector4 operator - (const Vector4 &v, const float s)
	{
		return Vector4(v.x - s, v.y - s, v.z - s, v.w - s);
	}

	Vector4 operator - (const float s, const Vector4 &v)
	{
		return Vector4(v.x - s, v.y - s, v.z - s, v.w - s);
	}

	Vector4 operator - (const Vector4 &v)
	{
		return Vector4(-v.x, -v.y, -v.z, -v.w);
	}

	Vector4 operator * (const Vector4 &u, const Vector4 &v)
	{
		return Vector4(u.x * v.x, u.y * v.y, u.z * v.z, u.w * v.w);
	}

	Vector4 operator * (const float s, const Vector4 &v)
	{
		return Vector4(v.x * s, v.y * s, v.z * s, v.w * s);
	}

	Vector4 operator * (const Vector4 &v, const float s)
	{
		return Vector4(v.x * s, v.y * s, v.z * s, v.w * s);
	}

	Vector4 operator / (const Vector4 &u, const Vector4 &v)
	{
		return Vector4(u.x / v.x, u.y / v.y, u.z / v.z, u.w / v.w);
	}

	Vector4 operator / (const Vector4 &v, const float s)
	{
		return Vector4(v.x / s, v.y / s, v.z / s, v.w / s);
	}

	Vector4 operator / (const float s, const Vector4 &v)
	{
		return Vector4(s / v.x, s / v.y, s / v.z, s / v.w);
	}

	bool operator == (const Vector4 &u, const Vector4 &v)
	{
		return (u.x == v.x && u.y == v.y && u.z == v.z && u.w && v.w);
	}
	
	float dot(const Vector4 &u, const Vector4 &v)
	{
		return u.x * v.x + u.y * v.y + u.z * v.z + u.w * v.w;
	}
}
